Literate Programming

نویسنده

  • Donald E. Knuth
چکیده

The past ten years have witnessed substantial improvements in programming methodology. This advance, carried out under the banner of “structured programming,” has led to programs that are more reliable and easier to comprehend; yet the results are not entirely satisfactory. My purpose in the present paper is to propose another motto that may be appropriate for the next decade, as we attempt to make further progress in the state of the art. I believe that the time is ripe for significantly better documentation of programs, and that we can best achieve this by considering programs to be works of literature. Hence, my title: “Literate Programming.” Let us change our traditional attitude to the construction of programs: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do. The practitioner of literate programming can be regarded as an essayist, whose main concern is with exposition and excellence of style. Such an author, with thesaurus in hand, chooses the names of variables carefully and explains what each variable means. He or she strives for a program that is comprehensible because its concepts have been introduced in an order that is best for human understanding, using a mixture of formal and informal methods that rëınforce each other. I dare to suggest that such advances in documentation are possible because of the experiences I’ve had during the past several years while working intensively on software development. By making use of several ideas that have existed for a long time, and by applying them systematically in a slightly new way, I’ve stumbled across a method of composing programs that excites me very much. In fact, my enthusiasm is so great that I must warn the reader to discount much of what I shall say as the ravings of a fanatic who thinks he has just seen a great light. Programming is a very personal activity, so I can’t be certain that what has worked for me will work for everybody. Yet the impact of this new approach on my own style has been profound, and my excitement has continued unabated for more than two years. I enjoy the new methodology so much that it is hard for me to refrain from going back to every program that I’ve ever written and recasting it in “literate” form. I find myself unable to resist working on programming tasks that I would ordinarily have assigned to student research assistants; and why? Because it seems to me that at last I’m able to write programs as they should be written. My programs are not only explained better than ever before; they also are better programs, because the new methodology encourages me to do a better job. For these reasons I am compelled to write this paper, in hopes that my experiences will prove to be relevant to others. I must confess that there may also be a bit of malice in my choice of a title. During the 1970s I was coerced like everybody else into adopting the ideas of structured programming, because I couldn’t bear to be found guilty of writing unstructured programs. Now I have a chance to get even. By coining the phrase “literate programming,” I am imposing a moral commitment on everyone who hears the term; surely nobody wants to admit writing an illiterate program.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Thirty Years of Literate Programming and More?

Don Knuth created Literate Programming about thirty years ago. It could be called a methodology, discipline, paradigm, . . . Bentley’s “Programming Pearls” article about Knuth’s book, TEX: The Program, caused a huge stir in the computing professions. Soon there was announcement of a Literate Programming section for the CACM . Several “Literate Programming systems” quickly appeared. This was fol...

متن کامل

An Elucidative Programming Environment for Scheme (Incomplete Draft)

In this paper we describe a programming environment for Scheme that supports elucidative programming. Scheme is a programming language in the Lisp family. Elucidative programming is a variant of literate programming. Literate programming represents the idea of structuring the program as fragments that are contained in an essay that documents the program understanding. Elucidative programming is...

متن کامل

AOPS: an abstraction-oriented programming system for literate programming

The practice of literate programming is not widespread because existing literate programming systems have some undesirable characteristics such as programming language and text processor dependence and lack of flexible tools for viewing and manipulation of the source file. This paper describes the literate programming system AOPS (Abstraction Oriented Programming System) which addresses both of...

متن کامل

A Literate Programming Tool for Concurrent Clean

Literate programming has attracted some interest in the functional programming community. This paper presents a prettyprinting algorithm used in a literate programming tool for the functional language Concurrent Clean, and discusses some of the issues involved in prettyprinting layout based languages. 1 Literate programming This section introduces the concept of literate programming for those w...

متن کامل

Literate Programming to Enhance Agile Methods

In this position paper, after explaining the essentials of literate programming, we argue that a literate programming style is consistent with the values espoused by agile software development; and that the application of literate programming in the context of an agile software development methodology is likely to enhance both the quality and lifespan of the final product.

متن کامل

Literate sources for content dictionaries

It is suggested that a LTEX document could be used as the Literate Programming source of an OpenMath content dictionary. Several approaches to literate programming are reviewed and a possible implementation is sketched.

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • Comput. J.

دوره 27  شماره 

صفحات  -

تاریخ انتشار 1984